home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7503 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.1 KB

  1. Path: surfnet.nl!sun4nl!xs4all!johnpc
  2. From: johnpc@xs4all.nl (Jan-Pieter Cornet)
  3. Newsgroups: comp.lang.misc,comp.lang.perl.misc,comp.lang.tcl,comp.lang.c,comp.lang.java,alt.lang.intercal,alt.test
  4. Subject: Re: Readable Perl (was: Re: Relative Speed of Perl vs. Tcl vs. C)
  5. Date: 27 Feb 1996 02:44:19 GMT
  6. Organization: XS4ALL Internet
  7. Message-ID: <4gtr64$s7h@news.xs4all.nl>
  8. References: <4e3a2u$eoa@wcap.centerline.com> <ukd97hwzkc.fsf_-_@linda.teleport.com> <4gb3kp$lu7@gaia.ns.utk.edu> <4ge7bk$4vq@news.ox.ac.uk>
  9. NNTP-Posting-Host: xs1.xs4all.nl
  10. Summary: hit "n" now! quick!
  11.  
  12. In article <4ge7bk$4vq@news.ox.ac.uk>,
  13. David Hopwood <lady0065@sable.ox.ac.uk> wrote:
  14. >In article <4gb3kp$lu7@gaia.ns.utk.edu>,
  15. >Matthew B. Kennel <kennel@msr.epm.ornl.gov> wrote:
  16. >>Randal L. Schwartz (merlyn@stonehenge.com) wrote:
  17. >>: >>>>> "John" == John Viega <jtv2j@mamba.cs.virginia.edu> writes:
  18. >>
  19. >>: John> People bitch about the readability of Perl non-stop.  In fact, I have
  20. >>: John> heard the joke, "Perl, the only language you can uuencode, and not
  21. >>: John> notice" twice this week around the department.
  22. >>
  23. >>: OK, now which do you find most readable...
  24. >
  25. >This (Haskell):
  26. >
  27. >cancount n = "I can count to "++(show n)++"\n"
  28. >concat (map cancount [1..10])
  29.  
  30. No, you got it all totally wrong. I think this is the best readable
  31. (in Tri-INTERCAL):
  32.  
  33.     DO ,1 <- #16
  34.     DO :2 <- #6490$#55022
  35.     PLEASE DO (44) NEXT
  36.     DO :2 <- #5631$#54733
  37.     PLEASE DO (44) NEXT
  38.     DO :2 <- #14637$#40039
  39.     PLEASE DO (44) NEXT
  40.     DO :2 <- #58550$#53112
  41.     PLEASE DO (44) NEXT
  42.     DO .1 <- #1
  43.     PLEASE DO (99) NEXT
  44.     DO GIVE UP
  45. (44)    DO REINSTATE COMING FROM
  46. (19)    DO COME FROM (68)
  47.     DO ABSTAIN FROM (19)
  48. (31)    DO COME FROM (34)
  49.     DO ABSTAIN FROM (31)
  50. (88)    DO COME FROM (65)
  51.     PLEASE ABSTAIN FROM (88)
  52.     DO COME FROM (44)
  53.     PLEASE DO (123) NEXT
  54.     DO .3 <- ':2~"#4$#13"'
  55.     DO :2 <- ':2~"#29520$#29511"'
  56.     DO ,1 SUB .1 <- .3
  57. (65)    DON'T GIVE UP
  58. (34)    PLEASE DON'T GIVE UP
  59. (68)    DO NOTE THAT THIS FUNNY CODE ACTUALLY WORKS
  60.     PLEASE RESUME #1
  61. (99)    DO COME FROM (69)
  62.     DO READ OUT ,1
  63.     DO ,1 SUB #1 <- #180
  64.     DO READ OUT .1
  65.     DO .2 <- "?.1$#10"~"#0$#29524"
  66.     PLEASE DO (15) NEXT
  67. (69)    PLEASE DO (123) NEXT
  68. (42)    DO RESUME .9
  69. (123)    PLEASE .8 <- #1
  70.     DO COME FROM (81)
  71.     DO .9 <- '?"V!1~.8'$#1"~#1'~#1
  72.     DO .1 <- "^.1$.8"~"#0$#29524"
  73.     PLEASE DO (42) NEXT
  74. (81)    DO .8 <- !8$#0'~"#9841$#1"
  75. (15)    PLEASE RESUME '?"!2~.2'~#2"$#1'~#1
  76.  
  77. Now, I think the advantages of this are pretty clear. First, this is
  78. clearly a write-only language. There are only few people insane enough
  79. to actually understand the above drivel, and they wouldn't bother
  80. touching your petty code, as they are too busy filling bathtubs with
  81. brightly colored machine tools.
  82.  
  83. Anyone else will simply be too scared to touch this code. So you can be
  84. pretty sure nobody changes it behind your back.
  85.  
  86. In fact, you can be pretty sure you won't change it either after you
  87. wrote it, because you will probably have forgotten how the program
  88. works 5 minutes after you wrote it. So any luser nagging for extra
  89. features afterwards, is SOL.
  90.  
  91. The other major advantage is... the above code took me about 3 hours
  92. to write. Compare this to the 10 to 30 seconds it takes to write a
  93. similar program in perl, BASIC, Haskell or what have you. But... that
  94. means that when you programmed it in that other language, you'd have to
  95. spend 2 hours 59 minutes and somewhere between 30 and 50 seconds
  96. answering the phone talking to clueless lusers, changing backup tapes,
  97. or doing other boring stuff. While you could have been programming
  98. Intercal instead! Just think about that!
  99.  
  100. And last, but certainly not least, is: the above code is likely to
  101. impress your boss. Bosses are wont to be impressed by incomprehensible
  102. things. They won't be impressed by a three line perl program that anyone
  103. not wearing a diaper can understand.
  104.  
  105. So that pretty much proves it.
  106.  
  107. PS: this article contains some strange usage of the words "best readable"
  108. that you probably weren't previously aware of :)
  109.  
  110. -- 
  111. Jan-Pieter Cornet                      <johnpc@xs4all.net>
  112. Actual quote: "Linux was made by foreign terrorists to steal money from true
  113.                AMERICAN companies like Microsoft who invented computing as we
  114.            know it, and are being punished for their success..."
  115. Linux -- "It's computing, Jim, but not as we know it"
  116.